package Javatest;

public class Fen {
    private String name;
    private  int quantity;
    private boolean likeSoup;


    public Fen(String name, int quantity, boolean likeSoup) {
        this.name = name;
        this.quantity = quantity;
        this.likeSoup = likeSoup;
    }

    public Fen(String name, int quantity) {
        this.name = name;
        this.quantity = quantity;
    }

    public Fen() {
        name="酸辣粉";
        quantity=2;
        likeSoup=true;
    }
    //写一个普通方法：String check()，方法的功能：用字符串连接符连接该类的三个属性并返回一个字符串，例如：“牛肉粉、2两、不带汤”。
    public String check(){
        return name+quantity+likeSoup;
    }

    public static void main(String[] args) {
        //定义一个主类，分别调用类WuMingFen的3个构造方法完成3个对象的创建，并调用check方法，输出其方法的返回值。
        Fen wuMingFen1=new Fen("牛肉粉",1,true);
        Fen wuMingFen2=new Fen("羊肉汤",2);
        Fen wuMingFen3=new Fen();
        System.out.println(wuMingFen1.check());
        System.out.println(wuMingFen2.check());
        System.out.println(wuMingFen3.check());
    }

}
